/**
 * 
 */
package com.eagle.coders.security.service;

import java.util.Map;

import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.eagle.coders.security.beans.UsersBean;
import com.eagle.coders.security.beans.dao.SecurityDao;
import com.eagle.coders.security.beans.dao.annotation.Security;

/**
 * @author Anees
 * 
 */
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class SecurityServiceBean implements SecurityService {

	// Injecting Security Dao to perform the query part by using jdbc
	@Inject	@Security SecurityDao securityDao;
	
	@PersistenceContext
		EntityManager entityManager;

	@Override
	@TransactionAttribute(TransactionAttributeType.NEVER)
	public UsersBean authenticateUser(UsersBean user) {
		System.out.println("[Service Bean] ");

		return securityDao.authenticateUser(user);
	}

	
	@Override
	@TransactionAttribute(TransactionAttributeType.REQUIRED)
	public UsersBean createUser(UsersBean userBean) {
		// TODO Auto-generated method stub
		return null;
	}



}
